package com.softstao.guoyu.mvp.interactor.shop;

import com.softstao.guoyu.global.APIInterface;
import com.softstao.guoyu.model.shop.OrderCondition;
import com.softstao.guoyu.model.shop.OrderId;
import com.softstao.guoyu.model.shop.ProductType;
import com.softstao.guoyu.model.shop.ShopIndex;
import com.softstao.guoyu.mvp.interactor.BaseInteractor;
import com.softstao.guoyu.utils.MyHttpParams;

import rx.functions.Action1;

/**
 * Created by vaikus on 2017/6/15.
 */

public class GoodsInteractor extends BaseInteractor {
    public void getCategory(int agentId, Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId", agentId);
        builder.setAction(action1)
                .setUrl(APIInterface.PRODUCT_CATEGORY)
                .setType(ProductType.class)
                .getVolley()
                .post(params);
    }

    public void getGoodsList(int page, int agentId, String typeId, Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId", agentId, "typeId", typeId,"pageSize","6","pageIndex",page);
        builder.setAction(action1)
                .setUrl(APIInterface.PRODUCT_LIST)
                .setType(ShopIndex.class)
                .getVolley()
                .post(params);
    }

    public void addOrder(OrderCondition condition,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams(condition);
        builder.setAction(action1)
                .setUrl(APIInterface.ADD_ORDER)
                .setType(OrderId.class)
                .getVolley()
                .post(params);
    }
}
